﻿using APP.HELPER.Data.Helper;
using APP.HELPER.Utils;
using APP.HELPER.Utils.Language;
using Common.Class;
using Common.Environment;
using DevExpress.LookAndFeel;
using DevExpress.Skins;
using DevExpress.UserSkins;
using Extra.Data.Extra.Class;
using HRM.UI.DS;
using Microsoft.VisualBasic.ApplicationServices;
using Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace HRM.UI
{
    internal class Form1 : WindowsFormsApplicationBase
    {
        [CompilerGenerated]
        private static EnumSotfType enumSotfType_0;
        private static Form1 form1_0;

        [DebuggerStepThrough]
        public Form1()
            : base(AuthenticationMode.Windows)
        {
            base.IsSingleInstance = true;
            base.EnableVisualStyles = true;
            base.SaveMySettingsOnExit = true;
            base.ShutdownStyle = ShutdownMode.AfterMainFormCloses;
        }

        [STAThread]
        private static void Main(string[] args)
        {
            //Options.FormLoading = new Common.XLoadingForm();
            //Options.FormProcess.SetProgressValue(1, MultiLanguages.GetString("tbl_Loading", "Starting", "Đang khởi động phần mềm..."));
            Options.FormLoading = new Common.XLoadingForm();
            Options.FormLoading.SetProgressValue(1, MultiLanguages.GetString("tbl_Loading", "Starting", "Đang khởi động phần mềm..."));
            SqlHelper.HideError = false;
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            dsUPDATE supdate = new dsUPDATE();
            supdate.UPDATE.AddUPDATERow("03a208c9-59c4-4e81-9e24-3322d0cab4ca", AssemblyHelper.AssemblyTitle, AssemblyHelper.AssemblyVersion, AssemblyHelper.AssemblyVersion, 0, "http://update.perfect.com.vn/QLNS/updateinfo.xml", 0xbb8, "Standard", System.Windows.Forms.Application.StartupPath);
            supdate.KillProcess.AddKillProcessRow("Perfect.Data");
            supdate.KillProcess.AddKillProcessRow("Perfect.Data.Config");
            supdate.KillProcess.AddKillProcessRow("PM.QLNS");
            supdate.KillProcess.AddKillProcessRow("Perfect.License");
            supdate.WriteXml(System.Windows.Forms.Application.StartupPath + @"\updateinfo.xml");
            Options.FormLoading.SetProgressValue(5, MultiLanguages.GetString("tbl_Loading", "LoadingInterface", "Đang nạp giao diện..."));
            BonusSkins.Register();
            OfficeSkins.Register();
            SkinManager.EnableFormSkins();
            try
            {
                DataSet set = new DataSet();
                set.ReadXml(System.Windows.Forms.Application.StartupPath + @"\Layout\theme.xml");
                UserLookAndFeel.Default.SkinName = set.Tables[0].Rows[0][0].ToString();
            }
            catch
            {
                UserLookAndFeel.Default.SkinName = "Office 2007 Blue";
            }
            Options.FormLoading.SetProgressValue(15, MultiLanguages.GetString("tbl_Loading", "SettingParameter", "Đang thiết lập tham số chương tr\x00ecnh..."));
            NetworkManager.ReadSysInfo();
            NetworkManager.Extract();
            Options.FormLoading.SetProgressValue(20, MultiLanguages.GetString("tbl_Loading", "SettingShortcut", "Đang thiết lập shortcut cho phần mềm..."));
            if (args.Length == 0)
            {
                APP.HELPER.Utils.Shell.Shell32.Create();
            }
            Options.FormLoading.SetProgressValue(0x19, MultiLanguages.GetString("tbl_Loading", "LookingData", "Đang t\x00ecm dữ liệu..."));
            Options.FormLoading.Hide();
            new MyLogon().FirstRun();
            form1_0 = new Form1();
            form1_0.Run(args);
        }

        [DebuggerStepThrough]
        void OnCreateMainForm()
        {
            base.MainForm = new Form0();
        }

        internal static Form1 Application
        {
            get
            {
                return form1_0;
            }
        }

        public static EnumSotfType SotfType
        {
            [CompilerGenerated]
            get
            {
                return enumSotfType_0;
            }
            [CompilerGenerated]
            set
            {
                enumSotfType_0 = value;
            }
        }
    }
}
